# -*- coding: utf-8 -*-
import scrapy
from white_album_scrapy.items import WhiteAlbumScrapyItem


class WhiteAlbumSpiderSpider(scrapy.Spider):
    name = "white_album_spider"
    allowed_domains = ["localhost:8888"]
    start_urls = ["http://localhost:8888"]

    def parse(self, response):
        sub_selector = response.xpath('//div[@class="para"]')

        items = []

        for sub in sub_selector:
            item = WhiteAlbumScrapyItem()
            item['para'] = sub.xpath('./text()').extract()
            items.append(item)

        return items
